package com.guaji.system

import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import com.guaji.system.NoteAPP.NoteMainActivity
import com.guaji.system.chat.mqtt.MqttMainActivity
import com.guaji.system.deepseek.DeepseekMainActivity
import com.guaji.system.gaodemap.MapMainActivity

class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        // 处理系统栏Insets
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
            val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
            insets
        }

        // 记事本按钮点击事件 - 启动NoteApp
        findViewById<androidx.cardview.widget.CardView>(R.id.noteButton).setOnClickListener {
            val intent = Intent(this, NoteMainActivity::class.java)
            startActivity(intent)
        }

        findViewById<androidx.cardview.widget.CardView>(R.id.deepseekButton).setOnClickListener {
            val intent = Intent(this, DeepseekMainActivity::class.java)
            startActivity(intent)
        }

        findViewById<androidx.cardview.widget.CardView>(R.id.mapButton).setOnClickListener {
            val intent = Intent(this, MapMainActivity::class.java)
            startActivity(intent)
        }

        findViewById<androidx.cardview.widget.CardView>(R.id.chatButton).setOnClickListener(){
            val intent = Intent(this, MqttMainActivity::class.java)
            startActivity(intent)
        }
    }
}